package com.ktjiaoyu.ch01_hello.controller;

import com.ktjiaoyu.ch01_hello.pojo.T365User;
import jakarta.annotation.Resource;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author Jane
 * @date 2024-05-22 16:35
 */

@RestController  //ajax   @ResponseBody
@RequestMapping("/hello")
public class HelloController {

    @Value("zhangchang")
    private String uname ;

    @Value("${czkt.t365.email}")
    private String uemail;


    @Resource
    T365User t365User;

    @RequestMapping("/index")
    public String index(){
        String msg = String.format("配置文件uname的值: %s,配置文件uemail的值: %s <br/>" +
                                    " bean中的username值:%s ,bean中的email值:%s "
                                    ,this.uname,this.uemail,t365User.getUsername(),t365User.getEmail()
                                );
        return msg;
    }
}
